package com.lightsh.utility;

import android.util.Log;

public class Debugger {
	
	private static final int DEBUG_LEVEL_ERROR = 0;
	private static final int DEBUG_LEVEL_WARNING = 1;
	private static final int DEBUG_LEVEL_DEBUG = 3;
	private static final int DEBUG_LEVEL_TRACK = 5;
	
	private static int CURRENT_DEBUG_LEVEL = 5;
	
	private static final String TAG = "Jbox2d";
	
	private static String getMessageString(String message){
		return (message == null) ? "null" : message;
	}
	
	public static void logE(String message){
		logE(TAG, message, true);
	}
	
	public static void logE(String tag, String message){
		logE(tag, message, true);
	}
	public static void logE(String tag, String message, boolean bLog){
		if(CURRENT_DEBUG_LEVEL >= DEBUG_LEVEL_ERROR && bLog){
			Log.e(tag, getMessageString(message));
		}
	}
	
	
	public static void logW(String message){
		logW(TAG, message, true);
	}
	
	public static void logW(String tag, String message){
		logW(tag, message, true);
	}
	public static void logW(String tag, String message, boolean bLog){
		if(CURRENT_DEBUG_LEVEL >= DEBUG_LEVEL_WARNING && bLog){
			Log.w(tag, getMessageString(message));
		}
	}
	
	
	public static void logD(String message){
		logD(TAG, message, true);
	}
	public static void logD(String tag, String message){
		logD(tag, message, true);
	}
	public static void logD(String tag, String message, boolean bLog){
		if(CURRENT_DEBUG_LEVEL >= DEBUG_LEVEL_DEBUG && bLog){
			Log.d(tag, getMessageString(message));
		}
	}
	
	public static void logT(String message){
		logT(TAG, message, true);
	}
	public static void logT(String tag, String message){
		logT(tag, message, true);
	}
	public static void logT(String tag, String message, boolean bLog){
		if(CURRENT_DEBUG_LEVEL >= DEBUG_LEVEL_TRACK && bLog){
			Log.i(tag, getMessageString(message));
		}
	}
	
	public static boolean isTrackEnable(){
		return CURRENT_DEBUG_LEVEL >= DEBUG_LEVEL_TRACK;
	}
}
